// 加载框架相关css
require.css( './login.css' );

var $ = dfish,
	login = {
	pwdRegex : /(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}/,
	enterKey : function(target) {
		 var e = window.event || arguments.callee.caller.arguments[0];
		 if (e && e.keyCode == 13) { // 回车事件
			 $.vm(target).cmd('login');
		 }
	},
	checkPwd : function(target,isReg){
		var vm = $.vm(target);
		var password = vm.fv('password');
		var cfmPassword = vm.fv('cfmPassword');
		var snapType = 'tb';
		if(password != cfmPassword){
			vm.cmd({type:'tip',prong :true, id:'tip_'+cfmPassword, snap:vm.f('cfmPassword'), text:'前后两次密码输入不一致', snaptype:snapType });
			return;
		} else {
			var tip = vm.find('tip_'+cfmPassword);
			if(tip){
				tip.close();
			}
			if(isReg){
				vm.cmd('doReg');
			}
		}
	}
};

//导出模块
module.exports = login;